const path = require('path');
function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  chainWebpack: config => {
    config.resolve.alias
      .set('@$', resolve('src'))
      .set('assets', resolve('src/assets'))
      .set('components', resolve('src/components'))
      .set('layout', resolve('src/layout'))
      .set('base', resolve('src/base'))
      .set('static', resolve('src/static'));
      // 生产环境配置
      if (process.env.NODE_ENV === 'production') {
        config.optimization.minimizer('terser').tap(args => {
          const compress = args[0].terserOptions.compress;
          // 非app平台移除console代码包含所有console方法（ｅｇ：　log, debug, info..)
          // compress.drop_console = true;
          compress.pure_funcs = [
            '__f__', //app平台vue移除日志
            // 'console.log',// 可移除指定的console方法
          ];
          return args;
        });
      }
  }
};
